package com.leyou.timer.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@SuppressWarnings("ALL")
/**
 * @Description :定时任务（删除oss图片）
 * @author     :LD
 */
@Component
@JobHandler(value = "leyou.clean.img.job") //  web配置JobHandler的名称
public class MyJob extends IJobHandler {
    /**
     * 但是spring的@Scheduled只支持6位，年份是不支持的，带年份的7位格式会报错：
     * Cron expression must consist of 6 fields (found 7 in "1/5 * * * * ? 2018")
     * 通过cron表达式 来配置 该方法的执行周期
     * **/
    @Autowired
    private CleanImageJob cleanImageJob;

    @Override
    public ReturnT<String> execute(String param) throws Exception {
        System.out.println("clearOssObject!!!!!!!!!");
//        cleanImageJob.cleanImage();
        return SUCCESS;
    }
}
